import { Asset, SpriteFrame, resources } from 'cc'
class ResourceCenter {
  loadSpriteDir(path: string, type: typeof Asset): Promise<SpriteFrame[]> {
    return new Promise((resolve, reject) => {
      resources.loadDir(path, type, (err, assets: SpriteFrame[]) => {
        if (err) {
          reject(err)
        } else {
          resolve(assets)
        }
      })
    })
  }
}

export default new ResourceCenter()
